﻿using System;
using System.Collections.Generic;

namespace Lottery.App.DAL
{
    internal class AnalyzeResult
    {
        public int MaxOmit { get; set; }

        public int LastID { get; set; }

        public int MaxOmitID { get; set; }

        public int TotalCount { get; set; }
    }

    internal class Tools
    {
        internal static AnalyzeResult Analyze(IList<int> ids)
        {
            AnalyzeResult a = new AnalyzeResult();
            a.TotalCount = ids.Count;
            a.LastID = ids[ids.Count - 1];

            a.MaxOmit = ids[0];
            a.MaxOmitID = ids[0];

            for (int i = 1; i < ids.Count; i++)
            {
                if (ids[i] - ids[i - 1] > a.MaxOmit)
                {
                    a.MaxOmit = ids[i] - ids[i - 1] - 1;
                    a.MaxOmitID = ids[i];
                }
            }

            return a;
        }
    }
}
